/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package main;

import java.util.ArrayList;
import java.util.Map;
import javax.faces.bean.ManagedBean;
import javax.faces.bean.RequestScoped;
import javax.faces.context.FacesContext;

/**
 *
 * @author Leonardo Lino
 */
@ManagedBean
@RequestScoped
public class SelectedTeatro {

    private String selected;
    private int numRows = 30;
    private int numColumns = 24;
    private ArrayList<Row> rows;

    /**
     * Creates a new instance of SelectedTeatro
     */
    public SelectedTeatro() {
    }
    
    public void preRender(){
        rows = insertExampleData();
    }

    public String passedParam() {
        FacesContext fc = FacesContext.getCurrentInstance();
        String str =
                (String) fc.getExternalContext().
                getRequestParameterMap().get("teatro");

        return str;
    }
    
    private ArrayList<Row> insertExampleData(){
        
        ArrayList<Row> rows = new ArrayList<Row>();
        
        for(int i = 0; i<20; i++){
            Row row = new Row();
            
            for (int j = 0; j<15; j++){
                
                Chair chair = new Chair();
                chair.id = j*i+i;
                row.chairs.add(chair);
            }
            rows.add(row);
        }
        return rows;
    }

    public ArrayList<Row> getRows() {
        return rows;
    }

    public void setRows(ArrayList<Row> rows) {
        this.rows = rows;
    }
    
    

    public String getSelected() {
        return passedParam();
    }

    public void setSelected(String selected) {
        this.selected = selected;
    }

    public int getNumRows() {
        return numRows;
    }

    public void setNumRows(int numRows) {
        this.numRows = numRows;
    }

    public int getNumColumns() {
        return numColumns;
    }

    public void setNumColumns(int numColumns) {
        this.numColumns = numColumns;
    }
    
    
    
    public class Row{
        public ArrayList<Chair> chairs = new ArrayList<Chair>();
        
    }
    
    public class Chair{
        public int id;
    }
}
